package com.shop.cereshop.business.service.order.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shop.cereshop.business.dao.order.CereOrderProductAttributeDAO;
import com.shop.cereshop.business.page.order.OrderProductAttribute;
import com.shop.cereshop.business.page.order.SkuDetail;
import com.shop.cereshop.business.param.order.ProductSku;
import com.shop.cereshop.business.service.order.CereOrderProductAttributeService;
import com.shop.cereshop.commons.domain.order.CereOrderProductAttribute;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class CereOrderProductAttributeServiceImpl extends ServiceImpl<CereOrderProductAttributeDAO, CereOrderProductAttribute> implements CereOrderProductAttributeService {

    @Override
    public List<CereOrderProductAttribute> findBySkuId(Long skuId) {
        return baseMapper.findBySkuId(skuId);
    }

    @Override
    public Boolean removeByOrderProductId(Long orderProductId) {
        return remove(new LambdaQueryWrapper<CereOrderProductAttribute>()
        .eq(CereOrderProductAttribute::getOrderProductId,orderProductId));
    }

    @Override
    public List<OrderProductAttribute> findBySkus(List<ProductSku> skus) {
        return baseMapper.findBySkus(skus);
    }

    @Override
    public List<SkuDetail> queryByOrderProductId(Long orderProductId) {
        return baseMapper.queryByOrderProductId(orderProductId);
    }
}
